﻿#ifndef WRITERA661_H
#define WRITERA661_H

#include <QFile>
#include <QDir>
#include <QDebug>
#include <QXmlStreamWriter>
#include <writewidget.h>
#include "datastruct.h"

using namespace etpXmlDataStruct;
using namespace sgfxXmlDataStruct;

class writera661
{
public:
    writera661();

    void genEtpFile(QString genEtpPath, EtpXmlData &etpXmlData);

    //null ide
    void printRdmfNullIDE(QXmlStreamWriter &writer);

    //ide
    void printRdmfIDE(QXmlStreamWriter &writer, const QString &rdmfPath, const IDE& ide);

    //symbology
    void printRdmfSymbology(QXmlStreamWriter &writer, const Symbology& symbology);

    //a661
    void printRdmfA661(QXmlStreamWriter &writer, const A661& a661);

    //dllProp
    void printDllProperties(QXmlStreamWriter &writer, const QString& layerId, const DllProperties& dllProperties, QString oid, const Symbology& symbology, int inContainer
                            , int layerWidth, int layerHeight, const Rule rule, const Rules rules, const ExtensionRules eRules
                            , const PropTypes &propTypes, const QMap<QString, QString> &constMap, const CommuParams &commuParams
                            , const SdyContent &sdys, const int cX, const int cY);

    //LayerWidgetChildren
    void printRdmfLayerWidgetChildren(QXmlStreamWriter &writer, const QString& layerId, const WidgetChildren& widgetChildren, const Symbology& symbology, int inContainer
                                      , int layerWidth, int layerHeight, const Rules rules, const ExtensionRules eRules
                                      , const PropTypes &propTypes, const QMap<QString, QString> &constMap, const CommuParams &commuParams
                                      , const SdyContent &sdys, const int cX, const int cY);

    //Layer
    void printRdmfLayer(QXmlStreamWriter &writer, const Layer& layer, const Symbology& symbology, const Rules rules, const ExtensionRules eRules,
                        const PropTypes &propTypes, const QMap<QString, QString> &constMap, const CommuParams &commuParams, const SdyContent &sdys);

    //LayerChildren
    void printRdmfLayerChildren(QXmlStreamWriter &writer, const LayerChildren& layerChildren, const Symbology& symbology, const Rules rules
                                , const ExtensionRules eRules, const PropTypes &propTypes, const QMap<QString, QString> &constMap
                                , const CommuParams &commuParams, const SdyContent &sdys);

    //spicification
    void printRdmfSpecification(QXmlStreamWriter &writer, const QString &rdmfPath, const Specification& specification, const Rules rules
                                , const ExtensionRules eRules, const PropTypes &propTypes, const QMap<QString, QString> &constMap
                                , const CommuParams &commuParams, const SdyContent &sdys);


    void genRdmfFile(QString genRdmfPath, SGFX &sgfx, const Rules rules, const ExtensionRules eRules, const PropTypes &propTypes
                     , const QMap<QString, QString> &constMap, const CommuParams &commuParams, const SdyContent &sdys);

    bool copyFilesByExtension(const QString& sourceFolderPath, const QString& targetFolderPath, const QStringList& extensions);

    void genResourceFile(QString genResourcePath, QString folderPath);

    bool copyDirectory(const QString &srcPath, const QString &dstPath);

    bool copyProjectFolder(const QString &etpPathAbs, const QString &genResourcePath);
};

#endif // WRITERA661_H
